package com.syh.jn.scm.infrastructure.repository.model.sale;

import com.syh.core.ddd.infrastructure.repository.model.SuperBusinessModel;
import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * 销售订单
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "T_SALE_ORDER")
@EqualsAndHashCode(callSuper = true)
public class SaleOrderModel extends SuperBusinessModel {
  /**
   * 销售订单编号
   */
  @Column(name = "CODE", columnDefinition = "varchar(100) COMMENT '订单编号'")
  private String code;
  /**
   * 第三方订单号
   */
  @Column(name = "EXT_CODE", columnDefinition = "varchar(100) COMMENT '第三方订单号'")
  private String extCode;
  /**
   * 销售订单状态(0：待确认 1：已确认 2：挂起 3：已生成对账单 -1：已取消)
   */
  @Column(name = "ORD_STATE", columnDefinition = "smallint COMMENT '销售订单状态(0：待确认 1：已确认 2：挂起 3：已生成对账单 -1：已取消)'")
  private Short ordState;
  /**
   * 订单创建类型(字典获取 fixed 0：服务商录入 1:客户录入 2：对接客户系统 3：系统自动)
   */
  @Column(name = "CREATED_TYPE", columnDefinition = "smallint COMMENT '(fixed字典获取  0：服务商录入 1:客户录入 2：对接客户系统 3：系统自动)'")
  private Short createdType;
  /**
   * 客户id
   */
  @Column(name = "DOWN_STREAM_COMPANY_ID", columnDefinition = "bigint COMMENT '客户id'")
  private Long downStreamCompanyId;
  /**
   * 优惠金额
   */
  @Column(name = "DISCOUNT", columnDefinition = "decimal(19,2) COMMENT '优惠金额'")
  private BigDecimal discount;
  /**
   * 订单总额
   */
  @Column(name = "TOTAL_AMOUNT", columnDefinition = "decimal(19,2) COMMENT '订单总额'")
  private BigDecimal totalAmount;
  /**
   * 商品总额
   */
  @Column(name = "GOODS_TOTAL_AMOUNT", columnDefinition = "decimal(19,2) COMMENT '商品总额'")
  private BigDecimal goodsTotalAmount;
  /**
   * 下游收货总额
   */
  @Column(name = "TOTAL_IN_AMOUNT", columnDefinition = "decimal(19,2) COMMENT '下游收货总额'")
  private BigDecimal totalInAmount;
  /**
   * 下游收货商品总额
   */
  @Column(name = "TOTAL_IN_GOODS_AMOUNT", columnDefinition = "decimal(19,2) COMMENT '下游收货商品总额'")
  private BigDecimal totalInGoodsAmount;
  /**
   * 出库总额
   */
  @Column(name = "TOTAL_OUT_AMOUNT", columnDefinition = "decimal(19,2) COMMENT '出库总额'")
  private BigDecimal totalOutAmount;
  /**
   * 出库商品总额
   */
  @Column(name = "TOTAL_OUT_GOODS_AMOUNT", columnDefinition = "decimal(19,2) COMMENT '出库商品总额'")
  private BigDecimal totalOutGoodsAmount;
  /**
   * 订单备注
   */
  @Column(name = "REMARK", columnDefinition = "varchar(300) COMMENT '订单备注'")
  private String remark;
  /**
   * 运费金额
   */
  @Column(name = "TOTAL_FREIGHT", columnDefinition = "decimal(19,2) COMMENT '运费金额'")
  private BigDecimal totalFreight;
  /**
   * 发货地区编码
   */
  @Column(name = "SHIP_AREA_CODE", columnDefinition = "varchar(100) COMMENT '发货地区编码'")
  private String shipAreaCode;
  /**
   * 发货地址省 市 区
   */
  @Column(name = "SHIP_AREA", columnDefinition = "varchar(100) COMMENT '发货地址省 市 区'")
  private String shipArea;
  /**
   * 发货人详细地址
   */
  @Column(name = "SHIP_ADDRESS", columnDefinition = "varchar(100) COMMENT '发货人详细地址'")
  private String shipAddress;
  /**
   * 录单人员id
   */
  @Column(name = "OPERATOR_ID", columnDefinition = "bigint COMMENT '录单人员id'")
  private Long operatorId;
  /**
   * 录入日期
   */
  @Column(name = "INPUT_DATE_TIMESTAMP", columnDefinition = "bigint COMMENT '录入日期'")
  private Long inputDateTimestamp;
  /**
   * 创建日期
   */
  @Column(name = "CREATE_TIME_STAMP", columnDefinition = "bigint COMMENT '创建日期'")
  private Long createTimeStamp;
  /**
   * 修改日期
   */
  @Column(name = "LAST_UPDATE_TIMESTAMP", columnDefinition = "bigint COMMENT '修改日期'")
  private Long lastUpdateTimestamp;
  /**
   * 收货时间
   */
  @Column(name = "RECEIPT_TIMESTAMP", columnDefinition = "bigint COMMENT '收货时间'")
  private Long receiptTimestamp;
  /**
   * 收货人姓名
   */
  @Column(name = "DELI_NAME", columnDefinition = "varchar(50) COMMENT '收货人姓名'")
  private String deliName;
  /**
   * 收货人联系电话
   */
  @Column(name = "DELI_TEL", columnDefinition = "varchar(50) COMMENT '收货人联系电话'")
  private String deliTel;
  /**
   * 收货地区编码
   */
  @Column(name = "DELI_AREA_CODE", columnDefinition = "varchar(50) COMMENT '收货地区编码'")
  private String deliAreaCode;
  /**
   * 收货地址省 市 区
   */
  @Column(name = "DELI_AREA", columnDefinition = "varchar(300) COMMENT '收货地址省 市 区 使用[广东省,广州市,海珠区]格式保存'")
  private String deliArea;
  /**
   * 收货人详细地址
   */
  @Column(name = "DELI_ADDRESS", columnDefinition = "varchar(300) COMMENT '收货人详细地址'")
  private String deliAddress;
  /**
   * 出库时间
   */
  @Column(name = "DELIVERY_TIMESTAMP", columnDefinition = "bigint COMMENT '出库时间'")
  private Long deliveryTimestamp;
  /**
   * 要求到货时间
   */
  @Column(name = "RECEIVE_TIMESTAMP", columnDefinition = "bigint COMMENT '要求到货时间'")
  private Long receiveTimestamp;
  /**
   * 物流生成状态(0：未生成物流单 1：部分生成物流单2：完成生成物流单)
   */
  @Column(name = "GENERATED_STATE", columnDefinition = "smallint COMMENT '物流生成状态(0：未生成物流单 1：部分生成物流单2：完成生成物流单)'")
  private Short generatedState;
    /**
     * 发货状态(0：未发货 1：部分发货 2：完成发货)
     */
  @Column(name = "DELIVERY_STATE", columnDefinition = "smallint COMMENT '发货状态(0：未发货 1：部分发货 2：完成发货)'")
  private Short deliveryState;
  /**
   * 签收状态(0：未签收 1：部分签收 2：完成签收)
   */
  @Column(name = "COLLECT_STATE", columnDefinition = "smallint COMMENT '签收状态(0：未签收 1：部分签收 2：完成签收)'")
  private Short collectState;
  /**
   * 对应对账单id
   */
  @Column(name = "STATEMENT_ID", columnDefinition = "bigint COMMENT '对账单ID'")
  private Long statementId;
  /**
   * 我方单据图片
   */
  @Column(name = "MAIN_SRC_IMAGES", columnDefinition = "varchar(1000) COMMENT '我方单据图片'")
  private String mainSrcImages;
  /**
   * 对方单据图片
   */
  @Column(name = "SECOND_SRC_IMAGES", columnDefinition = "varchar(1000) COMMENT '对方单据图片'")
  private String secondSrcImages;
  /**
   * 是否已生成记录(库存记录、应收付记录等)
   */
  @Column(name = "HAVE_RECORD", columnDefinition = "smallint COMMENT '是否已生成记录 0:未生成  1：已生成'")
  private Short haveRecord;
  /**
   * 订单费用表id
   */
  @Column(name = "ORDER_EXPENSES_BILL_ID", columnDefinition = "bigint COMMENT '订单费用表id'")
  private Long orderExpensesBillId;
  /**
   * 其他费用
   */
  @Column(name = "OTHER_EXPENSES", columnDefinition = "varchar(100) COMMENT '其他费用'")
  private BigDecimal otherExpenses;

}
